

import type { RouteObject } from "react-router"
import { useRoutes } from "react-router-dom"

import Login from "../views/login"
import Home from "../views/home"
import Eamil from "../views/eamil"
import Work from "../views/work"
import Comment from "../views/comment"
import Arichive from "../views/arichive"
import Page from "../views/page"
import Allachive from "../views/all_acrhive"
import Classfiy from "../views/classfiy"
import Tag from "../views/tag"

import Knowledge from "../views/knowledge"
import Poster from "../views/poster"
import Search from "../views/search"
import User from "../views/user"
import File from "../views/file/index"
import Monaco from "../views/monaco"
import Visit from "../views/visit"
import System from "../views/system"

interface IRouter extends RouteObject {
    name?: string
    children?: IRouter[]
}

export interface RouteType {
    path: string,
    element: any,
    name?: string,
    icon?: string,
    children?: RouteType[]
}


// export interface IRoute extends RouteObject {
//     name?: string,
//     children?: IRoute[],
//     icon?: JSX.Element
// }
export const Router1:IRouter[] = [
    {
        path: "/login",
        name: "登录",
        element: <Login />
    },
    {
        path:"/monaco",
        element: <Monaco />
    },
    {
        path: "/home",
        name: "后台管理",
        element: <Home />,
        children: [
            {
                path: "/home/work",
                name: "工作台",
                element: <Work />,
            },
            {
                path: "/home/arichive",
                name: "文章管理",
                element: <Arichive />,
            },
            {
                path: "/home/page",
                name: "页面管理",
                element: <Page />,
            },
            {
                path: "/home/eamil",
                name: "邮箱管理",
                element: <Eamil />,
            },
            {
                path: "/home/comment",
                name: "评论管理",
                element: <Comment />,
            },
            {
                path: "/home/classfiy",
                name: "分类管理",
                element: <Classfiy />,
            },
            {
                path: "/home/allachive",
                name: "所有文章",
                element: <Allachive />,
            },
            {
                path: "/home/tag",
                name: "标签管理",
                element: <Tag />,
            },
            {
                path: "/home/knowledge",
                name: "知识小册",
                element: <Knowledge />,
            },
            {
                path: "/home/poster",
                name: "知识小册",
                element: <Poster />,
            },
            {
                path: "/home/search",
                name: "搜索记录",
                element: <Search />,
            },
            {
                path: "/home/user",
                name: "用户管理",
                element: <User />,
            },
            {
                path:"/home/file",
                name:"文件管理",
                element:<File />,
            },
            {
                path:"/home/visit",
                name:"访问统计",
                element:<Visit />,
            },
            {
                path:"/home/system",
                name:"系统设置",
                element:<System />,
            },
        ]
    },
    
]

const RoutesMenu = () => {
    const routerCinfig = useRoutes(Router1)
    return routerCinfig
}
export default RoutesMenu
